// $codepro.audit.disable packageJavadoc
package gui.factory;
import iface.DiceInformation;
import iface.Modificator;

import javax.swing.JComboBox;

import definition.Dice;

/**
 * Factory class to build {@link JComboBox} objects.
 * 
 * @author Marcus Lindner
 * @author Joana Otetelisanu
 * 
 */
public final class SpecialJComboBoxFactory {
	/**
	 * @param modEnum 
	 * @param <T> 
	 * @return  a new combo box
	 * @wbp.factory
	 */
	public static <T extends Enum<T> & Modificator>  JComboBox createJComboBoxForModifiers(Class <T> modEnum) {
		final JComboBox comboBox = new JComboBox();
		for(T mod : modEnum.getEnumConstants()){
		    comboBox.addItem(mod);
		}
		return comboBox;
	}
	
	/**
	 * @param modEnum 
	 * @param <T> 
	 * @return  a new combo box
	 * @wbp.factory
	 */
	public static <T extends Enum<T> & DiceInformation>  JComboBox createJComboBoxForDiceInformation(Class <T> modEnum) {
		final JComboBox comboBox = new JComboBox();
		for(T mod : modEnum.getEnumConstants()){
		    comboBox.addItem(mod);
		}
		comboBox.setSelectedIndex(Dice.SIX_SIDED_DIE.ordinal());
		return comboBox;
	}
}